package com.aggregate.iot.sanstar.device;

import com.aggregate.iot.sanstar.device.bean.BasicResult;
import com.aggregate.iot.sanstar.device.bean.CmdAddData;
import com.aggregate.iot.sanstar.device.bean.CmdAddResult;
import com.aggregate.iot.sanstar.device.bean.CmdQueryData;
import com.aggregate.iot.sanstar.device.bean.CmdQueryResult;
import com.aggregate.iot.sanstar.device.bean.DeviceAddData;
import com.aggregate.iot.sanstar.device.bean.DeviceInfoData;
import com.aggregate.iot.sanstar.device.bean.DeviceInfoResult;
import com.aggregate.iot.sanstar.device.support.Client;
import com.aggregate.iot.sanstar.device.support.Config;
import com.aggregate.iot.sanstar.device.support.Factory;
import com.aggregate.iot.sanstar.device.support.HttpClient;
import com.aggregate.iot.sanstar.device.support.Merch;
import com.aggregate.iot.sanstar.device.support.client.CmdAdd;
import com.aggregate.iot.sanstar.device.support.client.CmdQuery;
import com.aggregate.iot.sanstar.device.support.client.DeviceAdd;
import com.aggregate.iot.sanstar.device.support.client.DeviceInfo;

/**
 * 物联网开放接口工具类，相关配置和接口调用从此类开始
 * @author Moyq5
 * @date 2018年11月12日
 */
public abstract class SanstarApiFactory {

	public static void config(Config config, HttpClient httpClient) {
		Factory.setConfig(config);
		Factory.setHttpClient(httpClient);
	}

	@SuppressWarnings("unchecked")
	public static Client<DeviceAddData, BasicResult> deviceAddClient(Merch merch) {
		return (Client<DeviceAddData, BasicResult>)Factory.getClient(DeviceAdd.class, merch);
	}

	@SuppressWarnings("unchecked")
	public static Client<DeviceInfoData, DeviceInfoResult> deviceInfoClient(Merch merch) {
		return (Client<DeviceInfoData, DeviceInfoResult>)Factory.getClient(DeviceInfo.class, merch);
	}

	@SuppressWarnings("unchecked")
	public static Client<CmdAddData, CmdAddResult> cmdAddClient(Merch merch) {
		return (Client<CmdAddData, CmdAddResult>)Factory.getClient(CmdAdd.class, merch);
	}

	@SuppressWarnings("unchecked")
	public static Client<CmdQueryData, CmdQueryResult> cmdQueryClient(Merch merch) {
		return (Client<CmdQueryData, CmdQueryResult>)Factory.getClient(CmdQuery.class, merch);
	}
	
}
